package org.example.service.impl;

import org.example.bean.Cake;
import org.example.bean.CakeCatalog;
import org.example.mapper.CakeCatalogMapper;
import org.example.mapper.CakeMapper;
import org.example.service.CakeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CakeServiceImpl implements CakeService {
    private CakeMapper cakeMapper;

    @Autowired
    public void setCakeMapper(CakeMapper cakeMapper) {
        this.cakeMapper = cakeMapper;
    }

    @Override
    public List<Cake> finAll() {
        List<Cake> list = new ArrayList<>();
        List<Cake> cakes = cakeMapper.finAll();
        for (Cake cata : cakes) {
            list.add(cata);
        }
        return list;
    }

    @Override
    public void delcakeid(int id) {
        cakeMapper.delcakeid(id);
    }

}
